package com.example.PriceCompare;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class SelectCity extends ListActivity{
	private ArrayAdapter<String> cityListAdapter ;
	
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		String[] Cities = getResources().getStringArray(R.array.CityList);
		this.setListAdapter(new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, Cities));
	}
	 @Override
		protected void onListItemClick(ListView l, View v, int position, long id) {
			super.onListItemClick(l, v, position, id);
			// Get the item that was clicked
			Object o = this.getListAdapter().getItem(position);
			String city = o.toString();
		Intent intent = new Intent();
		intent.putExtra("cityname", city);
		Log.i("tag", city);
 	    setResult(Activity.RESULT_OK,intent);
 	    this.finish();
	}

}
